﻿Public Class MakeTags

    Private Sub TagDateTimePicker_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TagDateTimePicker.ValueChanged
        Dim dateVal As Date
        ' "%-j/365 %-jof365 365-%-j project365 project366-1"
        dateVal = TagDateTimePicker.Value()
        TagsTextBox.Text = String.Format("{0}/365 {0}of365 365-{0} project365 project366-1", dateVal.DayOfYear)
    End Sub

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        ' Allow Escape to close (form needs to see the key before the active control does)
        Me.KeyPreview = True
        ' Default to today's date
        TagDateTimePicker.Value = Now()
    End Sub

    Private Sub CopyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyButton.Click
        Clipboard.SetData("Text", TagsTextBox.Text)
    End Sub

    Private Sub YesterdayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YesterdayButton.Click
        TagDateTimePicker.Value = Now() - New TimeSpan(1, 0, 0, 0)
    End Sub

    Private Sub TodayButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TodayButton.Click
        TagDateTimePicker.Value = Now()
    End Sub

    Private Sub MakeTags_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        ' Close on escape key
        If e.KeyCode = Keys.Escape Then
            Me.Close()
        End If
    End Sub

End Class
